/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercises.day04.pt01.bean;

import exercises.day04.pt02.Exception.AHBalanceIsNullException;
import exercises.day04.pt02.Exception.AHIdIsNullException;

/**
 *
 * @author Student
 */
public class Account_Holder {

    private Integer registrationID = 0;
    private Double balance = 0d;
    private String ahID = "";

    public Double getBalance() {
        return balance;
    }

    private void setBalance(String balance) throws AHBalanceIsNullException {
        if (balance == null) {
            throw new AHBalanceIsNullException();
        } else {

            try {
                this.balance = Double.valueOf(balance);
            } catch (NumberFormatException ex) {
                throw new AHBalanceIsNullException();
            }

        }
    }

    public Integer getRegistrationID() {
        return registrationID;
    }

    public void setRegistrationID(Integer registrationID) {
        this.registrationID = registrationID;
    }

    public Account_Holder(String ahID, Integer registrationID, String balance) throws AHIdIsNullException, AHBalanceIsNullException,AHBalanceIsNullException  {
        this.registrationID = registrationID;

        this.setBalance(balance);

        this.setAhID(ahID);
    }

    public String getAhID() {
        return ahID;
    }

    private void setAhID(String ahID) throws AHIdIsNullException {
        if (ahID == null || ahID.equals("")) {
            throw new AHIdIsNullException();

        } else {
            this.ahID = ahID;
        }

    }
}
